package com.drore.logapp.http.interceptor;

import android.content.Context;

import com.drore.logapp.base.BaseApplication;
import com.drore.logapp.utils.SpKeyUtils;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
 * Created by drore on 17/3/16.
 */

public class ReadCookiesInterceptor implements Interceptor {

    @Override
    public Response intercept(Chain chain) throws IOException {
        Request.Builder builder = chain.request().newBuilder();
        String preferences = BaseApplication.getSp().getString(SpKeyUtils.request_token, "null");
        builder.addHeader("request-token", preferences);
        Request build = builder.build();
        return chain.proceed(build);
    }
}
